package com.yzh.wanandroid.utils

import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import com.yzh.wanandroid.component.app.MainApplication

fun checkNetWork(): Boolean {
    val mConnectivityManager = MainApplication.appContext
        .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
    val mNetworkInfo = mConnectivityManager.activeNetworkInfo
    if (mNetworkInfo != null) {
        return mNetworkInfo.state == NetworkInfo.State.CONNECTED
    }
    return false
}